/*
 * Teknei 2014 - All rights reserved
 */
package com.teknei.acabus.core.facade;

import java.util.List;

import javax.ejb.Local;

import com.teknei.acabus.FacadeException;
import com.teknei.acabus.core.entities.NavigationChild;
import com.teknei.acabus.core.entities.NavigationParent;
import com.teknei.acabus.core.entities.Role;

/**
 * NavigationFacade interface for facade methods related to the Navigation based on Roles
 * @author Jorge Amaro
 * @version 1.0
 * @since 1.0
 *
 */
@Local
public interface NavigationFacade {

	/**
	 * Finds the NavigationParent elements based on the Role(s) that can access to them
	 * @param listRole the list of Role
	 * @return a List of NavigationParent
	 * @throws FacadeException
	 */
	List<NavigationParent> findNavigationParents(List<Role> listRole) throws FacadeException;

	/**
	 * Finds the NavigationChild based on the Role(s) that can access to the module and the NavigationParent
	 * @param listRole the list of Role(s)
	 * @param idParent the id of the parent record
	 * @return the list of NavigationChild elements
	 * @throws FacadeException
	 */
	List<NavigationChild> findNavigationChilds(List<Role> listRole, int idParent)
			throws FacadeException;

	/**
	 * Finds all the Role elements in the database
	 * @return the List<Role>
	 * @throws FacadeException
	 */
	List<Role> findRoles() throws FacadeException;

	/**
	 * Finds all the NavigationParent elements
	 * @return the List of NavigationParent
	 * @throws FacadeException
	 */
	List<NavigationParent> findNavigationParents() throws FacadeException;

	/**
	 * Finds all the NavigationChild element related to a parent id
	 * @param idParent the id of the parent record
	 * @return the List of NavigationChild elements
	 * @throws FacadeException
	 */
	List<NavigationChild> findNavigationChilds(int idParent)
			throws FacadeException;

	/**
	 * Saves a role on the database
	 * @param role the instance
	 * @return the ID of the record
	 * @throws FacadeException
	 */
	int saveRole(Role role) throws FacadeException;

	/**
	 * Updates a Role on the database
	 * @param role the instance
	 * @throws FacadeException
	 */
	void updateRole(Role role) throws FacadeException;

	/**
	 * Deletes a Role on the database
	 * @param role the instance
	 * @throws FacadeException
	 */
	void deleteRole(Role role) throws FacadeException;

	/**
	 * Saves a NavigationParent on the database
	 * @param parent the instance
	 * @return the id of the record
	 * @throws FacadeException
	 */
	int saveNavigationParent(NavigationParent parent) throws FacadeException;

	/**
	 * Saves a NavigationChild on the database
	 * @param child the instance
	 * @return the id of the record
	 * @throws FacadeException
	 */
	int saveNavigationChild(NavigationChild child) throws FacadeException;

	/**
	 * Updates a NavigationParent on the database
	 * @param parent the instance
	 * @throws FacadeException
	 */
	void updateNavigationParent(NavigationParent parent) throws FacadeException;

	/**
	 * Updates a NavigationChild on the database
	 * @param child the instance
	 * @throws FacadeException
	 */
	void updateNavigationChild(NavigationChild child) throws FacadeException;

	/**
	 * Deletes a NavigationParent on the database
	 * @param parent the instance
	 * @throws FacadeException
	 */
	void deleteNavigationParent(NavigationParent parent) throws FacadeException;

	/**
	 * Deletes a NavigationChild on the database
	 * @param child the instance
	 * @throws FacadeException
	 */
	void deleteNavigationChild(NavigationChild child) throws FacadeException;

	/**
	 * Finds the Roles allowed to access the module
	 * @param parent the NavigationParent element
	 * @return the List<Role> that can access to the NavigationParent
	 * @throws FacadeException
	 */
	List<Role> findRolesAllowed(NavigationParent parent) throws FacadeException;

	/**
	 * Finds the Roles allowed to access the module
	 * @param child the instance of NavigationChild
	 * @return the List of Roles that can access to the module
	 * @throws FacadeException
	 */
	List<Role> findRolesAllowed(NavigationChild child) throws FacadeException;

	/**
	 * Updates a NavigationParent element with its Collection of Roles. Updates the access to the module
	 * @param parent the NavigationParent element
	 * @throws FacadeException
	 */
	void updateNavigationParentWithRoles(NavigationParent parent)
			throws FacadeException;

	/**
	 * Finds all NavigationChild elements
	 * @return the list with all NavigationChild elements
	 * @throws FacadeException
	 */
	List<NavigationChild> findNavigationChilds() throws FacadeException;

	/**
	 * Updates a NavigationChild element with its Collection of Roles. Updates the access to the module
	 * @param child the instance
	 * @throws FacadeException
	 */
	void updateNavigationChildWithRoles(NavigationChild child)
			throws FacadeException;

}
